package com.company.pangu.sensitive.strategy;


import com.company.pangu.sensitive.enums.SensitiveDefaultLengthEnum;
import com.company.pangu.sensitive.util.SensitiveInfoUtils;

/**
 * 固话脱敏
 *
 * @author youyoukele
 * @version 1.0
 * @date 2022/09/05 10:34
 */
public class SensitiveFixedPhone implements IStrategy {

    @Override
    public String desensitization(String fixedPhone, int begin, int end) {
        if (begin != SensitiveDefaultLengthEnum.FIXED_PHONE.getBegin() && begin != 0 &&
                end != SensitiveDefaultLengthEnum.FIXED_PHONE.getEnd() && end != 0) {
            return SensitiveInfoUtils.fixedPhone(fixedPhone, end);
        }
        return SensitiveInfoUtils.fixedPhone(fixedPhone, SensitiveDefaultLengthEnum.FIXED_PHONE.getEnd());
    }

}
